<?php
defined('BASEPATH') or exit('No direct script access allowed');
require_once 'DB/MysqlModel.php';

class CustomerInfo extends MysqlModel
{

    public $table = 'comment';
    private $forList = array(
    'ths_am_gphone_login' => '手机炒股Gphone',
    'ths_am_iphone_login' => '手机炒股iPhone',
    'ths_am_ipad' => 'ipad程序',
    'ths_am_wphone_login' => '手机炒股wPhone',
    'IHexinFee' => '手机炒股至尊版',
    'autotrade' => '自动交易',
    'fund' => '基金理财',
    'kaihu' => '开户',
    'iwencai' => 'i问财',
    'iwencai_stock' => 'i问财选股',
    'NewThreeBoard' => '新三板',
    'ths_am_gphone_stocktrain' => '股市教练(gphone)',
    'ths_am_iphone_stocktrain' => '股市教练(iphone)',
    'yz_am_gphone' => '预装版',
    'am2011_htzq_gphone' => '华泰证券app',
    'invest_account' => '投资账本',
    'null' => 'null',
    'ths_metal_iphone_login' => '猎金大师iphone',
    'ths_metal_gphone_login' => '猎金大师gphone',
    );

    public function __construct()
    {
        $this->db = $this->load->database('zqpl', TRUE);
        parent::__construct();
        parent::setTable($this->table);
    }
    
    public function getCustomerInfo($userId){
        $table = $this->table;
        $this->db->select("*");
        $this->db->from($table);
        $this->db->where('userid',$userId);
        $this->db->order_by('ctime');
        $this->db->limit(1);
        $query = $this->db->get();
        $result = $query->result_array();
        if($result){
            $res = $result[0];
            $info['source'] = $res['source'];
            $info['model'] = $res['model'];
            $info['sdknum'] = $res['sdknum'];
            $info['appver'] = $res['appver'];
            $info['innerver'] = $res['appver1'];
            $info['for'] = $this->forList[$res['for']];
            $info['server'] = $res['server'];
            $info['modular'] = $res['modular'];
            $info['category'] = $res['category'];
            $info['addBrokerage'] = $res['remarks'];
        }else{
            $info = false;
        }
        return $info;
    }
    
    
    
}

